summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-tasks [TODO]
diff options
context:
space:
mode:
authormarlonivo <email@marlonivo.xyz>2025-04-14 09:16:38 +0000
committermarlonivo <email@marlonivo.xyz>2025-04-14 09:16:38 +0000
commit0d1a84f59d8cdd62c97410f96f8a13c98c51453a (patch)
tree01fee1d2003ea27f96a3e52b077827605ed14fab /.local/bin/statusbar/sb-tasks [TODO]
initialHEADmaster
Diffstat (limited to '.local/bin/statusbar/sb-tasks [TODO]')
-rwxr-xr-x.local/bin/statusbar/sb-tasks [TODO]16
1 files changed, 16 insertions, 0 deletions
diff --git a/.local/bin/statusbar/sb-tasks [TODO] b/.local/bin/statusbar/sb-tasks [TODO]
new file mode 100755
index 0000000..fbee70b
--- /dev/null
+++ b/.local/bin/statusbar/sb-tasks [TODO]
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# This block displays the number running background tasks. Requires tsp.
+
+num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
+
+# Handle mouse clicks
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e tsp -l ;;
+ 3) notify-send "Tasks module" "🤖: number of running/queued background tasks
+- Left click opens tsp" ;; # Right click
+ 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+[ "$num" != "0(0)" ] &&
+ echo "🤖$num"